package examples.jsf.lifecycle.impl;

import examples.jsf.FacesException;
import examples.jsf.component.UIComponent;
import examples.jsf.context.FacesContext;
import examples.jsf.event.PhaseId;

/**
 * @author Bill
 * @version 2013-05-29
 */
public class ApplyRequestValuesPhase extends Phase {
    @Override
    public void execute(FacesContext context) throws FacesException {
        UIComponent component = context.getViewRoot();

        if (null == component) {
            throw new IllegalArgumentException("viewRoot not found.");
        }

        // 处理 decode, 委托renderer实际处理
        component.processDecodes(context);
    }

    @Override
    public PhaseId getId() {
        return PhaseId.APPLY_REQUEST_VALUES;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
